#include "AnaDef.h"

void plot()
{
  TGraphErrors *gr = new TGraphErrors(3);
  gr->SetName("xlu");
  gr->SetPoint(0, 0.73, 0.019616);
  gr->SetPoint(1, 1.36, 0.026577);
  gr->SetPoint(2, 2.58, 0.046021);

  gr->SetPointError(0, 0.14, 0.000992);
  gr->SetPointError(1, 0.27, 0.001308);
  gr->SetPointError(2, 0.61, 0.003610);

  gr->SetMaximum(1);
  gr->SetMinimum(5e-3);
  gr->GetXaxis()->SetTitle("p (GeV/c");
  gr->GetYaxis()->SetTitle("Pion Efficiency");

  gr->Draw("apl");

  TFile *fout= new TFile("outplotEffvsMom_v3_03132012180417.root","recreate");
  gr->Write();
  fout->Save();
  fout->Close();
}

int main()
{
  plot();
  return 1;
}

// xlu@lxi041:~/.task/CommondEdx/myAnaData/Optimum/check11/Merged/LHC10e_plot$ date +%m%d%Y%H%M%S
// 03132012180417

// xlu@lxi041:~/.task/CommondEdx/myAnaData/Optimum/check11/Merged/LHC10e_plot$ for imom in $(echo 0 1 2 ); do head -n 65 ContaminationFit/np_type2par0mom$imom.log | tail -n 10 | awk '{print $2, $4",", $7, $8",", $22, $23, $24, $25, $26, $27}'; echo ; done
// mom>0.5 mom<1.0, 0.73#pm0.14 GeV/c, PIeff: 0.019616 0.000992 Eeff: 0.9015 0.0036
// mom>1.0 mom<2.0, 1.36#pm0.27 GeV/c, PIeff: 0.026577 0.001308 Eeff: 0.8966 0.0057
// mom>2.0 mom<5.0, 2.58#pm0.61 GeV/c, PIeff: 0.046021 0.003610 Eeff: 0.8995 0.0129

//             //neighbour
// mom>0.5 mom<1.0, 0.73#pm0.14 GeV/c, PIeff: 0.018950 0.000976 Eeff: 0.8948 0.0037
// mom>1.0 mom<2.0, 1.36#pm0.27 GeV/c, PIeff: 0.027965 0.001341 Eeff: 0.9037 0.0055
// mom>2.0 mom<5.0, 2.58#pm0.61 GeV/c, PIeff: 0.048397 0.003698 Eeff: 0.9049 0.0125


